package com.cloud.DrugManagement.config;

import com.cloud.DrugManagement.other.FeignMultipartFileEncoder;
import feign.Logger.Level;
import feign.codec.Encoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;

/**
 * @author zhozixiong
 * @date 2023/03/19
 *
 * openfeign配置类
 */
public class MultipartSupportConfig {

    /**
     * 启动openfeign日志功能
     */
    @Bean
    public Level getFeignLoggerLevel() {
        return Level.FULL;
    }

    @Bean
    public Encoder feignFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
        return new FeignMultipartFileEncoder(new SpringEncoder(messageConverters));
    }
}
